<html>
<head>
<#assign basePath=request.contextPath>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>后台管理系统</title>
    <link href="${basePath}/bootstrap/css/bootstrap.min.css" rel="stylesheet">
    <link href="${basePath}/bootstrap/css/font-awesome.min.css" rel="stylesheet">
    <link href="${basePath}/bootstrap/css/form.lzy.css" rel="stylesheet">
    <link href="${basePath}/bootstrap/css/good.lzy.css" rel="stylesheet">
    <link href="${basePath}/bootstrap/plugin/bootstrap-datetimepicker/bootstrap-datetimepicker.min.css"
          rel="stylesheet">
    <style>
        #page-wrapper h1 {
            display: block;
            margin-bottom: 20px;
            border-bottom: 1px solid #999;
            font-size: 16px;
            padding-left: 2px;
            font-weight: bold;
            line-height: 35px;
        }

        #depart-box label {
            display: inline-block;
            margin: 20px 20px 0;
        }

        #depart-box .bot {
            display: block;
            padding-top: 50px;
            text-align: center;
        }

    </style>
</head>
<body>

<div class="panel panel-lzy">
    <div class="panel-body">
        <h5 class="tips-lzy">操作提示</h5>
        <ul class="tips-list-lzy">
            <li><span>◆&nbsp;<span>标识“<font color="red">*</font>”的选项为必填项，其余为选填项。</span></span></li>
        </ul>
    </div>
</div>

<div id="page-wrapper">
    <div class="panel panel-f5">
        <div class="panel-body row">
            <h1>● 基础信息</h1>
            <form id="Form" class="form-horizontal" method="post">
                <input type="hidden" id="_ctx" value="${basePath}"/>
                <input type="hidden" id="id" name="id" <#if dto??>value="${dto.id!}"</#if>/>
                <div class="form-group">
                    <span class="control-label col-sm-2 col-xs-4  detail-span"><font
                            color="red">*</font>&nbsp;产品名称：</span>
                    <div class="col-sm-9 col-xs-8">
                        <input type="text" class="form-control" size="50" name="name" maxlength="50" value="${dto.name!}" readonly>
                    <#--<span class="text-warning">0/50</span>-->
                    </div>
                </div>
                <div class="form-group">
                    <span class="control-label col-sm-2 col-xs-4  detail-span">&nbsp;<font color="red">*</font>&nbsp;产品售价：</span>
                    <div class="col-sm-9 col-xs-8">
                        <input type="text" class="form-control" size="30" name="price" maxlength="10" value="${(dto.price)?c}" readonly>
                    </div>
                </div>

                <div class="form-group">
                    <span class="control-label col-sm-2 col-xs-4  detail-span">&nbsp;<font color="red">*</font>&nbsp;产品封面：</span>
                    <div class="col-sm-9 col-xs-8">
                        <input class="obj-input" id="cover" name="cover" value="${dto.cover!}" type="text" readonly>
                        <img class="obj-img" src="${dto.cover!}" width="100" height="100">
                    </div>
                </div>
                <div class="form-group">
                    <span class="control-label col-sm-2 col-xs-4 detail-span">产品视频：</span>
                    <div class="col-sm-9 col-xs-8">
                        <input class="obj-input" id="fileValue" name="video" value="${dto.video!}" type="text" readonly>
                    <#--<img class="obj-img" src="${dto.video!}" width="100" height="100">-->
                        <video id="fileName" src="${dto.video!}" controls="controls" style="max-height: 200px;">
                            您的浏览器不支持 video 标签。
                        </video>
                    </div>
                </div>
                <h1>● 详细描述</h1>
                <div class="form-group">
                    <span class="control-label col-sm-2 col-xs-4">产品介绍：</span>
                    <div class="col-sm-9 col-xs-8 add-box image-text">
                    <#list dto.detailImages as imageText>
                        <#if imageText.type == 1>
                            <div class="text-box">
                                    <textarea data-id="0" name='detailImages[0].path' maxlength="1900" rows="3"
                                              cols="50" class="form-control"
                                              placeholder="最多输入2000字" readonly>${imageText.path!}</textarea>
                                <input class="sort" name='detailImages[0].sort' value="0" type="hidden"/>
                                <input name='detailImages[0].type' value="1" type="hidden"/>
                            </div>
                        <#elseif imageText.type == 2>
                            <div class="text-box">
                                <div class="upload-box">
                                    <input class="obj-input" name="detailImages[1].path" value="${imageText.path!}"
                                           type="hidden" readonly>
                                    <img class="obj-img" src="${imageText.path!}">
                                    <input class="sort" name='detailImages[1].sort' value="1" type="hidden"/>
                                    <input name='detailImages[1].type' value="2" type="hidden"/>
                                </div>
                            </div>
                        </#if>
                    </#list>
                    </div>
                </div>
                <hr/>
                <div class="form-group">
                    <span class="control-label col-sm-2 col-xs-4  detail-span"><font
                            color="red">*</font>&nbsp;文档名称：</span>
                    <div class="col-sm-9 col-xs-8">
                        <input type="text" class="form-control" size="50" name="officeName" maxlength="50" value="${dto.officeName!}" readonly>
                    <#--<span class="text-warning">0/50</span>-->
                    </div>
                </div>
                <div class="form-group">
                    <span class="control-label col-sm-2 col-xs-4 detail-span"><font
                            color="red">*</font>&nbsp;上传文档：</span>
                    <div class="col-sm-9 col-xs-8">
                        <input type="text" id="fileText" class="form-control" size="50" value="${dto.office!}" readonly />
                    <#--<input type="file" data-action="office" data-image="word" onchange="uploadFile(this)" id="file">-->
                        <input type="hidden" id="fileValue" name="office" value="${dto.office!}" readonly>
                    </div>
                </div>
                <hr/>
                <div class="form-group">
					<span class="control-label col-sm-2 col-xs-4 detail-span"><span
                            class="text-red"></span> 备注：</span>
                    <div class="col-sm-10 col-xs-8 add-box">
                        <div class="text-box">
                        <#--<span class="text-warning">&nbsp;0/1000</span>-->
                            <textarea data-id="0" name='remark' id="remark"
                                      class="form-control" maxlength="900" value="" readonly>${dto.remark!}</textarea>
                        </div>
                    </div>
                </div>

                <h1>● 产品是否开通身份</h1>
                <div class="form-group">
                    <span class="control-label col-sm-2 col-xs-4 detail-span">&nbsp;身份：</span>
                    <div class="col-sm-9 col-xs-8">
                    <#if dto.identityName??>
                        <input type="text" class="form-control" value="${dto.identityName!}" readonly>
                    <#else>
                        <span class="col-sm-2 col-xs-4 detail-span">产品未开通身份</span>
                    </#if>
                    </div>

                </div>
                <h1>● 产品内容</h1>
                <div class="pro-box">
                <#if proList??>
                    <#list proList as pro>
                        <#if (pro.containNum)??>
                            <div class="form-group">
                        <span class="control-label col-sm-2 col-xs-4">
                            &nbsp;${pro.name!}：</span>
                                <div class="col-sm-9 col-xs-8 check-box">
                                    <input type="text" class="form-control" size="30" maxlength="10"
                                           name="projectList[${pro_index!}].containNum"
                                           value="${(pro.containNum)?c}" readonly>&nbsp;${pro.unit!}&nbsp;
                                    <#if pro.projectId == 3 || pro.projectId == 4>
                                        <span>有效天数
                                    <input type="text" class="form-control" size="30" maxlength="6" min="1"
                                           name="projectList[${pro_index!}].validTime" value="${(pro.validTime)?c}" readonly>&nbsp;天</span>
                                    </#if>
                                    <select class="form-control" name="projectList[${pro_index!}].type" disabled>
                                        <option value="0" <#if (pro.type)?? && pro.type == 0>selected</#if>>固定项</option>
                                        <option value="1" <#if (pro.type)?? && pro.type == 1>selected</#if>>单选项</option>
                                    </select>
                                    <span class="text-warning">请输入该产品单笔包含${pro.name!}的数量</span>
                                </div>
                            </div>
                        </#if>
                    </#list>
                </#if>
                </div>
                <h1>● 其他设置</h1>
                <div class="form-group">
                    <span class="control-label col-sm-2 col-xs-4 detail-span">选择分类：</span>
                    <div class="col-sm-9 col-xs-8">
                    <#if (dto.classifyName)??>
                        <input id="departName" type="text" class="form-control" size="30" name="departName" value="${dto.classifyName!}"
                               readonly>
                    </#if>
                    </div>
                </div>
                <div class="form-group">
                    <span class="control-label col-sm-2 col-xs-4  detail-span">&nbsp;分类拨比设置：</span>
                    <div class="col-sm-9 col-xs-8">
                    <#if (dto.profit)??>
                        <input type="text" class="form-control" size="30" name="profit" value="${dto.profit}" maxlength="10" readonly><span>%</span>
                    </#if>
                    </div>
                </div>
                <hr>
                <div class="form-group">
                    <span class="control-label col-sm-4 col-xs-4"></span>
                    <div class="col-sm-8 col-xs-8">
                        <button type="button" class="btn btn-info" onclick="goBack()"><i class="fa fa-close"></i>返回</button>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>

<script src="${basePath}/bootstrap/js/jquery.js" type="text/javascript"></script>
<script src="${basePath}/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
<script src="${basePath}/bootstrap/plugin/layer/layer.js" type="text/javascript"></script>
<script src="${basePath}/bootstrap/js/common.js" type="text/javascript"></script>
<script>

    function goBack(){
        window.location.href = "${basePath}/admin/product/info";
    }
    $(function () {
        $(".check-input").each(function () {
            var _this = $(this).parent().siblings(".check-box");
            if ($(this).is(":checked")) {
                _this.show();
            } else {
                _this.hide();
            }
        })
    })

    $(function() {
    <#--var imgArr = ${orderProductDto.credentialsUrl};-->
    <#--var temp = "";-->
    <#--for(var i= 0,len=imgArr.length;i<len;i++){-->
    <#--temp += '<img src="'+imgArr[i]+'" height="100">';-->
    <#--$("#credentialsUrl").append(temp);-->
    <#--}-->

        $(".upload-box img").each(function () {
            $(this).click(function () {

                var _this = "<img src='" + $(this).attr("src") + "' style='max-height: 100%; max-width:100%'>";
                console.log(_this);
                layer.open({
                    type: 1,
                    area: ['auto', 'auto'],
                    title: false,
                    content: _this,
                    end: function () {
                        layer.closeAll()
                    }
                });
            })
        })
    })

</script>
</body>
</html>
